Skip to content

CI Addition (ECH): Check only the public SNI is visible#10542

Closed
sebastian-carpenter wants to merge 2 commits into
wolfSSL:masterfrom
sebastian-carpenter:public-sni-test
Closed

CI Addition (ECH): Check only the public SNI is visible#10542
sebastian-carpenter wants to merge 2 commits into
wolfSSL:masterfrom
sebastian-carpenter:public-sni-test

Conversation

@sebastian-carpenter

@sebastian-carpenter sebastian-carpenter commented May 27, 2026

Copy link
Copy Markdown
Contributor

Description

Added a test to check that the SNI in the outer ClientHello is always the public SNI. Other checks exist to verify the inner SNI is correct. Also added additional testing for the ECH rejection path as well.

Corrected TLSX_EchChangeSNI to always swap the SNI when it is processing the outer hello.

Testing

Added test_wolfSSL_Tls13_ECH_wire_sni which forces a HelloRetryRequest with either ech rejection or acceptance.

Added interop testing for the ECH rejection path.

Checklist

  • added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

@sebastian-carpenter sebastian-carpenter self-assigned this May 27, 2026
Copilot AI review requested due to automatic review settings May 27, 2026 16:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug in ECH (Encrypted Client Hello) outer ClientHello handling so that the public SNI is always substituted into the outer ClientHello (regardless of echAccepted state or innerCount), preventing leakage of the private SNI on the wire. A corresponding wire-bytes test is added.

Changes:

  • Simplify the condition in TLSX_EchChangeSNI to swap the SNI whenever the ECH extension type is ECH_TYPE_OUTER.
  • Add test_wolfSSL_Tls13_ECH_wire_sni covering both ECH-accept and ECH-reject paths, forcing a HelloRetryRequest and asserting the public name appears and the private name does not appear on the wire for both CH1 and CH2.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/tls.c Always swap SNI to the public name when processing the outer ClientHello, removing extra gating conditions.
tests/api.c New ECH wire-SNI test (accept + reject paths with HRR) registered in testCases.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sebastian-carpenter sebastian-carpenter marked this pull request as ready for review May 27, 2026 16:50
@github-actions

Copy link
Copy Markdown

retest this please

Comment thread tests/api.c Outdated
{
EXPECT_DECLS;
test_ssl_memio_ctx test_ctx;
WOLFSSL_CTX* tempCtx = NULL;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reduce the scope - put declarations down in block where used.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, moved them down to !accept block.

Comment thread tests/api.c Outdated
WOLFSSL_ERROR_WANT_READ);

/* CH2 wire bytes: same property must hold */
ExpectNotNull(mymemmem(test_ctx.s_buff, test_ctx.s_len,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we expect echCbTestPublicName to be at a specific location?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! Removed memmem check and replaced it with ech_find_extension to only perform the check at the SNI extension.

Once more extensions are added to ECH this test should be refactored to check that those are swapped out as well.

@sebastian-carpenter

sebastian-carpenter commented May 28, 2026

Copy link
Copy Markdown
Contributor Author

Rebased to get ech_find_extension. 'check sent SNI is correct' comments mark the major change locations for checking the SNI.

Added a sanity check at the end of the test to make sure ECH is suceeding or failing as expected.

@sebastian-carpenter

sebastian-carpenter commented May 28, 2026

Copy link
Copy Markdown
Contributor Author

Jenkins retest this please

@douzzer douzzer added the Conflicts Conflicts with master or staged PRs label Jun 5, 2026
@sebastian-carpenter

Copy link
Copy Markdown
Contributor Author

Moving this into #10568 since it only contains testing now. #10568 was also the source for this wire_sni test anyway.

sebastian-carpenter added a commit to sebastian-carpenter/wolfssl that referenced this pull request Jun 8, 2026
- *_wire_sni test is now more efficient
- openssl-ech workflow now does interop with ECH rejection
sebastian-carpenter added a commit to sebastian-carpenter/wolfssl that referenced this pull request Jun 8, 2026
- *_wire_sni test is now more efficient
- openssl-ech workflow now does interop with ECH rejection
sebastian-carpenter added a commit to sebastian-carpenter/wolfssl that referenced this pull request Jun 9, 2026
- *_wire_sni test is now more efficient
- openssl-ech workflow now does interop with ECH rejection
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Conflicts Conflicts with master or staged PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants